<% layout('/layouts/default.html', {title: '商户信息审核', libs: ['validate','fileupload']}){ %>
<div class="main-content">
    <div class="box box-main">
        <div class="box-header with-border">
            <div class="box-title">
                <i class="fa icon-note"></i> ${text('商户信息审核')}
            </div>
            <div class="box-tools pull-right hide">
                <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
            </div>
        </div>
        <#form:form id="inputForm" model="${merchant}" action="${ctx}/merchant/merchant/reviewData" method="post" class="form-horizontal">
        <div class="box-body">
            <div class="form-unit">${text('基本信息')}</div>
            <#form:hidden path="id"/>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('商户名称')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="name" maxlength="64" readonly="true" placeholder="请输入商户名称" readonly="true" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('负责人')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="director" readonly="true" maxlength="64" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('负责人电话')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="phone" readonly="true" maxlength="32" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('商户地址')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:input path="place" readonly="true" maxlength="64" class="form-control"/>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('营业执照')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <div class="custom-box">
                                <div class="custom-center-title">
                                    <ul class="custom-ul" id="image"></ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required hide">*</span> ${text('商户logo')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <div class="custom-box">
                                <div class="custom-center-title">
                                    <ul class="custom-ul" id="logo"></ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-6">
                    <div class="form-group">
                        <label class="control-label col-sm-4" title="">
                            <span class="required">*</span> ${text('审核结果')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-8">
                            <#form:radio path="reviewStatus" dictType="review_status" class="form-control required" data-msg-required="请选择审核结果."/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-xs-12">
                    <div class="form-group">
                        <label class="control-label col-sm-2" title="">
                            <span class="required">*</span> ${text('备注')}：<i class="fa icon-question hide"></i></label>
                        <div class="col-sm-10">
                            <#form:textarea path="remarks" rows="4" maxlength="500" class="form-control"/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-footer">
            <div class="row">
                <div class="col-sm-offset-2 col-sm-10">
                    <% if (hasPermi('car:car:edit')){ %>
                    <button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
                    <% } %>
                    <button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
                </div>
            </div>
        </div>
    </#form:form>
</div>
</div>
<% } %>
<script>

    let imgList = [],imgList1 = [];
    //图片初始显示
    const merchant = JSON.parse('${toJson(merchant)}'),baseUrl='${baseUrl}';
    imgList = [{imageUrl:merchant.licenseUrl}];
    imgList1 = [{imageUrl:merchant.logoUrl}]
    imgShow(0,imgList);
    imgShow(1,imgList1);
    function imgShow(num,attr){
        let html = '';
        let windowURL = window.URL || window.webkitURL;
        for(let i =0;i<attr.length;i++) {
            console.log("111111",attr[i].imgType)
            if (num == 0){
                let dataURL = baseUrl + attr[i].imageUrl;
                html +='<li class="custom-li">' +
                    '<div><img class="custom-img-box" src="'+dataURL+'"></div>' +
                    '</li>';
            }else if(num == 1){
                let dataURL = baseUrl + attr[i].imageUrl;
                html +='<li class="custom-li">' +
                    '<div><img class="custom-img-box-1" src="'+dataURL+'"></div>' +
                    '</li>';
            }

        }
        if(attr.length>0){
            $('#showBtn').hide();
        }else{
            $('#showBtn').show();
        }
        if (num == 0){
            $('#image').html(html);
        }else if(num == 1){
            $('#logo').html(html);
        }

    }


    $("#inputForm").validate({
        submitHandler: function(form){
            js.ajaxSubmitForm($(form), function(data){
                js.showMessage(data.message);
                if(data.result == Global.TRUE){
                    js.closeCurrentTabPage(function(contentWindow){
                        contentWindow.page();
                    });
                }
            }, "json");
        }
    });
</script>

<style>
    .custom-img-box{
        width: 200px;
        height: 110px;
        overflow: hidden;
        vertical-align: middle;
        border-radius: 5px;
        border: 1px solid #f1f1f1;
    }

    .custom-img-box-1{
        width: 110px;
        height: 110px;
        overflow: hidden;
        vertical-align: middle;
        border-radius: 5px;
        border: 1px solid #f1f1f1;
    }
</style>